#ifndef __PE_Detect_H
#define __PE_Detect_H

#ifdef APM32E10X_HD
	#include "apm32e10x_gpio.h"
	#include "apm32e10x_rcm.h"
	#include "apm32e10x_eint.h"
	#include "apm32e10x_misc.h"
	
#elif defined AT32F403AVGT7
	#include "at32f403a_407_gpio.h"
	#include "at32f403a_407_crm.h"
	#include "at32f403a_407_exint.h"
	#include "at32f403a_407_misc.h"
	
#else
	#include "apm32f10x_gpio.h"
	#include "apm32f10x_rcm.h"
	#include "apm32f10x_eint.h"
	#include "apm32f10x_misc.h"
	
#endif


// 漏电引脚 // 
#ifdef SQDri_EVSEB_7KW
	//引脚块1 = 接引脚块C = PC8
	#define PE_RTC             RCM_APB2_PERIPH_GPIOC
	#define PE_PinPort         GPIOC
	#define PE_PinId           GPIO_PIN_8
	
#elif defined SQDri_EVSEB_11KW
	//引脚块1 = 接引脚块C = PC8
	#define PE_RTC             RCM_APB2_PERIPH_GPIOC
	#define PE_PinPort         GPIOC
	#define PE_PinId           GPIO_PIN_8

#else
	//引脚块1 = 接引脚块A = PA1
	#define PE_RTC             RCM_APB2_PERIPH_GPIOA
	#define PE_PinPort         GPIOA
	#define PE_PinId           GPIO_PIN_1
	//外部中断
	#define PE_EintPort        GPIO_PORT_SOURCE_A
	#define PE_EintPin         GPIO_PIN_SOURCE_1
	#define PE_EintLine        EINT_LINE_1
	#define PE_EintIRQn        EINT1_IRQn
#endif

#if PE_method == PE_method_ADC
	#define PE_ADC_Chn         ADC_CHANNEL_1
	#define PE_ADC_Value       1500
#endif

void PE_Detect_init(void);
uint8_t PE_get_level(void);


#endif


